home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 2.0a3 / Universal AIncludes / TranslationExtensions.a < prev    next >
Encoding:
Text File  |  1994-11-11  |  4.2 KB  |  147 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        TranslationExtensions.a
  3. ;
  4. ;    Copyright:    © 1984-1994 by Apple Computer, Inc.
  5. ;                All rights reserved.
  6. ;
  7. ;    Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8. ;
  9. ;    Bugs?:        If you find a problem with this file, send the file and version
  10. ;                information (from above) and the problem description to:
  11. ;
  12. ;                    Internet:    apple.bugs@applelink.apple.com
  13. ;                    AppleLink:    APPLE.BUGS
  14. ;
  15. ;
  16.  
  17.     IF &TYPE('__TRANSLATIONEXTENSIONS__') = 'UNDEFINED' THEN
  18. __TRANSLATIONEXTENSIONS__ SET 1
  19.  
  20.  
  21.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  22.     include 'Memory.a'
  23.     ENDIF
  24. ;        include 'Types.a'                                            ;
  25. ;            include 'ConditionalMacros.a'                            ;
  26. ;        include 'MixedMode.a'                                        ;
  27.  
  28.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  29.     include 'Files.a'
  30.     ENDIF
  31. ;        include 'OSUtils.a'                                        ;
  32.  
  33.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  34.     include 'Quickdraw.a'
  35.     ENDIF
  36. ;        include 'QuickdrawText.a'                                    ;
  37.  
  38.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  39.     include 'Components.a'
  40.     ENDIF
  41.  
  42. kSupportsFileTranslation        EQU        1
  43. kSupportsScrapTranslation        EQU        2
  44. kTranslatorCanGenerateFilename    EQU        4
  45.  
  46. taDstDocNeedsResourceFork        EQU        1
  47. taDstIsAppTranslation            EQU        2
  48.  
  49. FileTypeSpec             RECORD    0
  50. format                     ds.l    1
  51. hint                     ds.l    1
  52. flags                     ds.l    1                                    ; taDstDocNeedsResourceFork, taDstIsAppTranslation
  53. catInfoType                 ds.l    1
  54. catInfoCreator             ds.l    1
  55. sizeof                     EQU    20
  56.                         ENDR
  57.  
  58. FileTranslationList     RECORD    0
  59. modDate                     ds.l    1
  60. groupCount                 ds.l    1
  61. ;     unsigned long    group1SrcCount;
  62. ;     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);
  63. ;  FileTypeSpec    group1SrcTypes[group1SrcCount]
  64. ;  unsigned long    group1DstCount;
  65. ;  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);
  66. ;  FileTypeSpec    group1DstTypes[group1DstCount]
  67. sizeof                     EQU    8
  68.                         ENDR
  69.  
  70. ScrapTypeSpec             RECORD    0
  71. format                     ds.l    1
  72. hint                     ds.l    1
  73. sizeof                     EQU    8
  74.                         ENDR
  75.  
  76. ScrapTranslationList     RECORD    0
  77. modDate                     ds.l    1
  78. groupCount                 ds.l    1
  79. ;     unsigned long        group1SrcCount;
  80. ;     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);
  81. ;  ScrapTypeSpec        group1SrcTypes[group1SrcCount]
  82. ;  unsigned long        group1DstCount;
  83. ;     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);
  84. ;  ScrapTypeSpec        group1DstTypes[group1DstCount]
  85. sizeof                     EQU    8
  86.                         ENDR
  87.  
  88. ; definition of callbacks to update progress dialog
  89. ;****************************************************************************************
  90. ;*
  91. ;* This routine sets the advertisement in the top half of the progress dialog.
  92. ;* It is called once at the beginning of your DoTranslateFile routine.
  93. ;*
  94. ;* Enter:    refNum            Translation reference supplied to DoTranslateFile.
  95. ;*            advertisement    A handle to the picture to display.  This must be non-purgable.
  96. ;*                            Before returning from DoTranslateFile, you should dispose
  97. ;*                            of the memory.  (Normally, it is in the temp translation heap
  98. ;*                            so it is cleaned up for you.)
  99. ;*
  100. ;* Exit:    returns            noErr, paramErr, or memFullErr
  101. ;
  102.     IF GENERATING68K THEN
  103.         Macro
  104.         _SetTranslationAdvertisement
  105.             moveq    #2,d0
  106.             dc.w     $ABFC
  107.         EndM
  108.     ELSE
  109.         IMPORT    SetTranslationAdvertisement
  110.     ENDIF
  111.  
  112. ;****************************************************************************************
  113. ;*
  114. ;* This routine updates the progress bar in the progress dialog.
  115. ;* It is called repeatedly from within your DoTranslateFile routine.
  116. ;* It should be called often, so that the user will get feedback if he tries to cancel.
  117. ;*
  118. ;* Enter:    refNum        translation reference supplied to DoTranslateFile.
  119. ;*            progress    percent complete (0-100)
  120. ;*
  121. ;* Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  122. ;*            returns        noErr, paramErr, or memFullErr
  123. ;
  124.     IF GENERATING68K THEN
  125.         Macro
  126.         _UpdateTranslationProgress
  127.             moveq    #1,d0
  128.             dc.w     $ABFC
  129.         EndM
  130.     ELSE
  131.         IMPORT    UpdateTranslationProgress
  132.     ENDIF
  133.  
  134. ; ComponentMgr selectors for routines
  135.  
  136. kTranslateGetFileTranslationList EQU        0                    ; component selectors
  137. kTranslateIdentifyFile            EQU        1
  138. kTranslateTranslateFile            EQU        2
  139. kTranslateGetTranslatedFilename    EQU        3
  140. kTranslateGetScrapTranslationList EQU        10                ; skip to scrap routines
  141. kTranslateIdentifyScrap            EQU        11
  142. kTranslateTranslateScrap        EQU        12
  143.  
  144. ; Routines to implment in a file translation extension
  145. ; Routine to implement in a scrap translation extension
  146.     ENDIF ; __TRANSLATIONEXTENSIONS__
  147.